#!/usr/bin/env bash

set -eou pipefail

if [ -z ${DRONE_TAG+x} ]; then
    tag=$(git name-rev --tags --name-only $(git rev-parse HEAD))
else
    tag="$DRONE_TAG"
fi

echo "$tag"

if [[ "$tag" == "undefined" ]]; then
    echo "not on a tag"
    exit 0
fi

maturin upload --skip-existing --username "$MATURIN_USERNAME" "$1"
